cmake_minimum_required(VERSION 3.20 FATAL_ERROR)

# get project name
# project name and language
get_filename_component(CURRENT_DIR_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
message(STATUS "Current Directory Name: ${CURRENT_DIR_NAME}")

# Project name and a few useful settings. Other commands can pick up the results
project(
        ${CURRENT_DIR_NAME}
        VERSION 0.1
        DESCRIPTION "An example project with CMake"
        LANGUAGES CXX
)

option(Asan "add asan" OFF)

set(LIBRARY_PATH ${PROJECT_SOURCE_DIR}/3rdparty)

# we default to Release build type
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)
endif()
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

#find library
#set(Boost_NO_BOOST_CMAKE ON)
#set(BOOST_ROOT ${LIBRARY_PATH}/boost)
#set(Boost_NO_SYSTEM_PATHS ON)
#find_package(Boost 1.70 REQUIRED)

# compiler flags
list(APPEND flags "-fPIC" "-Wall")

if(NOT WIN32)
    list(APPEND flags "-Wextra" "-Wpedantic")
endif()

if( "${CMAKE_BUILD_TYPE}" STREQUAL "Debug" )
    list(APPEND flags "-g")
else()
    list(APPEND flags "-o2")
endif()

add_subdirectory(src)







